<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>title</title>


<script type="text/javascript" src="/tour/js/jquery.js"></script>
<script type="text/javascript" src="/tour/js/jquery-ui.js"></script>
<link type="text/css" href="/tour/css/jquery-ui.css" rel="stylesheet">


<style type="text/css">

#container{
	width:1100px;
	
	margin:auto;/*센터로 정렬시킨다*/
}
#head{
	padding: 5px;
	height: 10px;
	text-align: right;	
	

}


#top{
	padding: 5px;
	text-align: center;	
	
	  /*border를 1px씩 주게 되면 width가 딱맞게 만들 경우 선때문에 outer공간이 모자라 모양이 깨진다.*/
}




#header{
	padding: 5px;
	text-align: center;	
/*	
	border:1px solid gray;
	*/
	  /*border를 1px씩 주게 되면 width가 딱맞게 만들 경우 선때문에 outer공간이 모자라 모양이 깨진다.*/
}



#left{
	padding: 5px;
	width:180px;/*height는 주지 않는다. 내용에 따라 늘어나도록 처리하기 위해*/
	float:left;/*경계선 때문에*/
	/*clear:both;*/
}

#content{
	padding: 5px;
	width:820px;/*height는 주지 않는다. 내용에 따라 늘어나도록 처리하기 위해*/
	float:left;/*경계선 때문에*/
	/*clear:both;*/
}






#footer{
	padding-top:5px;
	
	clear:both;  /*이것이 없으면 left, content 아래로 들어가 버린다.*/
	text-align:center;
	height:50px;
}
</style>
</head>
<body>
<div id="container" >
	
	<div id="head">
		<jsp:include page="/templates/header.jsp"/>
	</div>
	
	<div id="top">
		<jsp:include page="/templates/top.jsp"/>
	</div>
	

	<div id="header">
		<jsp:include page="/templates/top_menu.jsp"/>
	</div>



	<div id="left" >
		<jsp:include page="/templates/banner.jsp"/>
		
	</div>
	
		<div id="content" >
		

<h2>글목록</h2>

<table id="content" border="1">
	<tr>
		<td width="65px">글번호</td>
		<td>제목</td>
		<td width="80px">작성자</td>
		<td width="60">작성일</td>
		<td width="60">조회수</td>
	</tr>
<!-- --------------------------------게시물 목록---------------------------------------------- -->
<!-- 
	게시물의 제목에 링크를 걸어 클릭시 그 글의 상세사항을 볼 수 있도록 한다.
	답변 글들의 제목은 답변의 level만큼 공백을 먼저 주고 답변이라는 것을 표시한다. (여기서는 '→' 사용)
-->	
	<c:forEach items="${requestScope.list }" var="Cmboard">
		<tr>
			<td>${Cmboard.no }</td>
			<td>
				<c:forEach begin="1" end="${Cmboard.relevel }" step="1">
					&nbsp;&nbsp;
				</c:forEach>
				<c:if test="${Cmboard.relevel != 0 }">
					→
				</c:if>
				<a href="/tour/cm_board/getContent.do?no=${Cmboard.no }&page=${requestScope.pagingBean.currentPage}">
					${Cmboard.title }
				</a>
			</td>
			<td>${Cmboard.writer }</td>
			<td>${Cmboard.writedate }</td>
			<td>${Cmboard.viewcount }</td>
		</tr>	
	</c:forEach>
<!-- --------------------------------게시물 목록---------------------------------------------- -->	
</table>
<p>
<!-- --------------------------------페이징 처리---------------------------------------------- -->
<table>
	<tr>
		<td>		
		<c:choose>
			<c:when test="${requestScope.pagingBean.previousPageGroup }">
				<a href="/tour/cm_board/list.do?page=${requestScope.pagingBean.startPageOfPageGroup -1 }">
				◀
				</a>
			</c:when>
			<c:otherwise>
				◀
			</c:otherwise>
		</c:choose>
		<c:forEach begin="${requestScope.pagingBean.startPageOfPageGroup }"
							   end="${requestScope.pagingBean.endPageOfPageGroup }"
							   step="1"
							   var ="i">
			<c:choose>
				<c:when test="${i == requestScope.pagingBean.currentPage }">
					${i }
				</c:when>
				<c:otherwise>
					<a href="/tour/cm_board/list.do?page=${i }">${i }</a>
				</c:otherwise>
			</c:choose>			
		</c:forEach>
		<c:choose>
			<c:when test="${requestScope.pagingBean.nextPageGroup }">
				<a href="/tour/cm_board/list.do?page=${requestScope.pagingBean.endPageOfPageGroup + 1 }">
					▶
				</a>
			</c:when>
			<c:otherwise>
				▶
			</c:otherwise>
		</c:choose>
		
		<td>
	</tr>
</table>
<!-- --------------------------------페이징 처리---------------------------------------------- -->
<a href="/tour/cm_board/write_form.do">글쓰기</a>
<br>
		
	</div>
	











	<div id="footer" >
		<jsp:include page="/templates/footer.jsp"/>
	</div>
</div>

</body>
</html>